package com.cskaoyan.catmall.service.Impl;

import com.cskaoyan.catmall.dao.MarketGoodsMapper;
import com.cskaoyan.catmall.dao.MarketGoodsProductMapper;
import com.cskaoyan.catmall.dao.MarketOrderMapper;
import com.cskaoyan.catmall.dao.MarketUserMapper;
import com.cskaoyan.catmall.model.vo.InfoDataVO;
import com.cskaoyan.catmall.service.InfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @date: 2022-01-08-20-19
 * @author: ZYY
 * @description:
 */
@Service
public class InfoServiceImp implements InfoService {
    @Autowired
    MarketUserMapper userMapper; // 用户

    @Autowired
    MarketGoodsMapper goodsMapper; // 商品

    @Autowired
    MarketOrderMapper orderMapper; // 订单

    @Autowired
    MarketGoodsProductMapper productMapper;


    @Override
    public InfoDataVO dashboard() {
        int userCount = userMapper.selectCount();
        int goodsCount = goodsMapper.selectCount();
        int orderCount = orderMapper.selectCount();
        int productCount = productMapper.selectCount();
        InfoDataVO data = new InfoDataVO(goodsCount,userCount,productCount,orderCount);
        return data;
    }
}